import java.text.BreakIterator;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane.MaximizeAction;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/30 10:16
 * @description:
 */
public class Five {

  public static void main(String[] args) {
    int[] arr = {20, 10, 45, 24, 78, 53, 100, 60};

    printArry(arr);

   mySout(arr);
    System.out.println("排序结果");
    printArry(arr);
    int max = myMax(arr);
    System.out.println(max);
    int min = mymin(arr);
    System.out.println(min);
  }



  private static void printArry(int[] arr) {
    for (int i=0;i<arr.length;i++){
      System.out.print(arr[i]+"\t");
    }
    System.out.println();
  }

  private static int mymin(int[] arr) {
    int min = arr[0];
    for (int i = 0; i < arr.length; i++) {
      if (arr[i] < min) {
        min = arr[i];

      }

    }
    return min;
  }

  private static int myMax(int[] arr) {

    int max=arr[0];
    for (int i=0;i<arr.length;i++){
      if (arr[i]>max){
        max=arr[i];

      }

    }


    return max;

  }

  private static void mySout(int[] arr) {
    int a;
    for (int i=0;i<arr.length-1;i++){
      for(int j=0;j<arr.length-i-1;j++){
       if(arr[j]>arr[j+1]){
         a=arr[j];
         arr[j]=arr[j+1];
         arr[j+1]=a;

           }
       }
     }

  }
}
